import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProPlanVO, ProPlanForm, ProPlanQuery } from '@/api/project/plan/types';

/**
 * 分页查询项目计划列表
 * @param query
 * @returns {*}
 */
export const pageListProPlan = (query?: ProPlanQuery): AxiosPromise<ProPlanVO[]> => {
    return request({
        url: '/pro/plan/page',
        method: 'get',
        params: query
    });
};

/**
 * 查询项目计划列表（非分页）
 * @param query
 * @returns {*}
 */
export const listProPlan = (query?: any): AxiosPromise<ProPlanVO[]> => {
    return request({
        url: '/pro/plan/list',
        method: 'get',
        params: query
    });
};

/**
 * 查询项目计划详细
 * @param id
 */
export const getProPlan = (id: string | number): AxiosPromise<ProPlanVO> => {
    return request({
        url: '/pro/plan/' + id,
        method: 'get'
    });
};

/**
 * 新增项目计划
 * @param data
 */
export const addProPlan = (data: ProPlanForm) => {
    return request({
        url: '/pro/plan',
        method: 'post',
        data: data
    });
};

/**
 * 修改项目计划
 * @param data
 */
export const updateProPlan = (data: ProPlanForm) => {
    return request({
        url: '/pro/plan',
        method: 'put',
        data: data
    });
};

/**
 * 删除项目计划
 * @param id
 */
export const delProPlan = (id: string | number | Array<string | number>) => {
  return request({
    url: '/pro/plan/' + id,
    method: 'delete'
  });
};